package com.htgd.gardenexpo.service.impl;

import com.htgd.gardenexpo.entity.GeConExplainFeedback;
import com.htgd.gardenexpo.dao.GeConExplainFeedbackDao;
import com.htgd.gardenexpo.service.GeConExplainFeedbackService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (GeConExplainFeedback)表服务实现类
 *
 * @author makejava
 * @since 2021-06-17 13:57:46
 */
@Service("geConExplainFeedbackService")
public class GeConExplainFeedbackServiceImpl implements GeConExplainFeedbackService {
    @Resource
    private GeConExplainFeedbackDao geConExplainFeedbackDao;

    /**
     * 通过ID查询单条数据
     *
     * @param 主键
     * @return 实例对象
     */
    @Override
    public GeConExplainFeedback queryById() {
        return this.geConExplainFeedbackDao.queryById();
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<GeConExplainFeedback> queryAllByLimit(int offset, int limit) {
        return this.geConExplainFeedbackDao.queryAllByLimit(offset, limit);
    }

    @Override
    public List<GeConExplainFeedback> getinfoByEplainId(int id) {
        return this.geConExplainFeedbackDao.getinfoByEplainId(id);
    }

    /**
     * 新增数据
     *
     * @param geConExplainFeedback 实例对象
     * @return 实例对象
     */
    @Override
    public GeConExplainFeedback insert(GeConExplainFeedback geConExplainFeedback) {
        this.geConExplainFeedbackDao.insert(geConExplainFeedback);
        return geConExplainFeedback;
    }

    /**
     * 修改数据
     *
     * @param geConExplainFeedback 实例对象
     * @return 实例对象
     */
    @Override
    public GeConExplainFeedback update(GeConExplainFeedback geConExplainFeedback) {
        this.geConExplainFeedbackDao.update(geConExplainFeedback);
        return this.queryById();
    }

    /**
     * 通过主键删除数据
     *
     * @param 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById() {
        return this.geConExplainFeedbackDao.deleteById() > 0;
    }

    @Override
    public boolean deleteByExplainId(int id) {
        return this.geConExplainFeedbackDao.deleteByExplainId(id) > 0;
    }
}
